package com.mb.app.controller;

import com.mb.app.domain.TbAboutUs;
import com.mb.app.service.ITbAboutUsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * <p>
 * 关于我们  前端控制器
 * </p>
 *
 * @author liliping
 * @since 2019-04-01
 */
@Controller
@RequestMapping("/app/aboutUs")
@Slf4j
public class TbAboutUsController {

    @Autowired
    private ITbAboutUsService aboutUsService;
    
    @GetMapping("/info")
    String infoPage(){
        return "app/aboutUs/aboutUs_info";
    }

    @ResponseBody
    @GetMapping("/getInfo")
    public TbAboutUs getInfo(@RequestParam Map<String, Object> params){
        TbAboutUs aboutUs = aboutUsService.getInfo();
        return aboutUs;
    }

    @ResponseBody
    @PostMapping("/save")
    public TbAboutUs save(TbAboutUs aboutUs, HttpServletRequest request){
        aboutUsService.save(aboutUs);
        aboutUs = aboutUsService.getInfo();
        return aboutUs;
    }
	
}
